﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

public partial class Main_ServiceInvoice_ServiceClassification : System.Web.UI.Page
{
    Datautility du = new Datautility();
    string sql="";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["hidenvalue"] != null && Request.QueryString["Txtbox"] != null)
            {
                hidServiceIdControl.Value = Request.QueryString["hidenvalue"].ToString();
                hidServiceNameControl.Value = Request.QueryString["Txtbox"].ToString();
                hidServiceIdValue.Value = Request.QueryString["ServiceId"].ToString();
            }            
            BindGrid();
        }
    }

    protected void BindGrid()
    {
        sql = "select * from SVT_SERVICEMASTER";
        DataTable dt = du.getdata(sql);
        if (dt.Rows.Count > 0)
        {
            GrdClassification.DataSource = dt;
            GrdClassification.DataBind();
        }
    }
    protected void GrdClassification_OnRowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            HiddenField hidServiceId = (HiddenField)e.Row.FindControl("hidServiceId");
            Label lblServiceName = (Label)e.Row.FindControl("lblServiceName");           
            if (hidServiceId.Value.ToString() == hidServiceIdValue.Value.ToString())
            {
                e.Row.BackColor = Color.FromName("#d6efff");                                
                e.Row.Font.Bold = true;                
            }            
            e.Row.Attributes.Add("ondblclick", "ReturnValue('" + hidServiceId.ClientID + "','" + lblServiceName.ClientID + "');");
        }
    }
}